package com.java.ssm.controerll;

import com.java.ssm.entity.Menu;
import com.java.ssm.service.impl.MenuServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class Login {
    @Autowired
    private MenuServiceImpl menuServiceImpl;

    @RequestMapping("/login")
    public String login(HttpServletRequest request) {

        List<Menu> menu = menuServiceImpl.getMenu();
        request.getSession().setAttribute("menu",menu);
        request.getSession().setAttribute("admin",5);
        System.out.println(menu);

        return "jsp/index";
//        return "redirect:/jsp/index.jsp";
    }

}
